<template>
  <div class="app-container">
    <el-form
      :model="form"
      ref="form"
      label-width="80px"
      :inline="true"
      size="normal"
    >
      <el-form-item label="数据日期">
        <el-date-picker v-model="form.day" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" @change="chooseDate">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">生成数据</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import staApi from '@/api/sta'
export default {
  data() {
    return {
      form: {
        day: null,
      },
    };
  },
  methods: {
    chooseDate(date) {
      this.form.day = date
    },
    async onSubmit() {
      let res = await staApi.registerCount(this.form.day)
      console.log(res);
      if(res.success) {
        this.$message.success("生成统计数据成功")
      }else{
        return this.$message.error(res.msg)
      }
    },
  },
};
</script>

<style lang="scss" scoped>
</style>